home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / AMOSPRO6.DMS / in.adf / Procedures / Techniques / _Radar.AMOS / _Radar.amosSourceCode next >
Encoding:
AMOS Source Code  |  1992-09-29  |  19.6 KB  |  455 lines

  1. '******************************************************* 
  2. '*                                                     * 
  3. '* AMOS Professional Procedure Library                 * 
  4. '*                                                     * 
  5. '* Procedure: Radar Routine                            *     
  6. '*                                                     * 
  7. '*    Author: Mike Stevens                             *   
  8. '*                                                     * 
  9. '******************************************************* 
  10. '
  11. '                            RADAR ROUTINE 
  12. '
  13. '                                 and  
  14. '
  15. '                               A M O S  
  16. '                  *       **      ******  ******  **    **   *****            
  17. '                ***      **        **    **      ***   **  **                   
  18. '              **  *     **        **    *****   ** *  **   ****                 
  19. '            *******    **        **    **      **  * **      **                   
  20. '          **      *   **        **    **      **   ***      **                  
  21. '        **        *  ******  ******  ******  **    **  *****              
  22. '
  23. '                  By Mike Stevens, Immortal Software 1992.
  24. '
  25. '  The main part to this program is the set of procedures which constitute 
  26. 'the radar routine. With these, you can easily set up and operate a radar
  27. 'scanner for use in games. In order to put the radar procedures through their
  28. 'paces, I decided I would have to write a game which actually used them; and 
  29. 'so AMOS ALIENS was born.
  30. '
  31. '  Instructions: 
  32. '    Responding to a distress call from a space station, you and your crew 
  33. '   boarded the vessel. The whole ship seemed derelict, as if no one had ever
  34. '   been there; until, that is, you stumbled across deck three...
  35. '    Corpses littered the floor, fresh blood lined the walls; it wasn't a
  36. '   pretty sight. You were so stunned, you didn't even notice the approaching
  37. '   creatures until they were on top of you. The rest of your crew were  
  38. '   too slow; they were wiped out after the first attack. Luckily, you managed 
  39. '   to survive. Now, armed with only your machine gun and movement detector, 
  40. '   you must wipe out the alien horde. 
  41. '    Due to the fact that your only light source is a small helmet-torch,
  42. '   you can only see, and fire within an area of 5 by 5 squares at any time. 
  43. '   Your only hope lies in your radar, with which you can detect the movements 
  44. '   of the enemy around you. Use the cursor keys to move, and the space bar
  45. '   to fire in the direction you are facing. You are represented by an 'O',
  46. '   the space station's walls by a '#' or a '*', and the aliens by a 'X'. The
  47. '   aliens aren't armed, but they're fast, and there are lots of them. 
  48. '
  49. '  There are a couple of minor bugs in the game, most notably that since the 
  50. 'walls are generated totally randomly, it is quite possible that you could be
  51. 'totally isolated from any or all of the aliens, making it impossible to 
  52. 'complete. However, the basic game is quite fun, even with it's pathetic 
  53. 'graphics, and it demonstrates the principle of how to use the radar. This 
  54. 'little program has inspired me, and I intend to develop a more graphical, 
  55. 'fully featured version... 
  56. '
  57. '************************************************************************* 
  58. '
  59. ' Set up some constants... 
  60. _UP=0 : _DOWN=1 : _LEFT=2 : _RIGHT=3
  61. _MAPWID=25 : _MAPHGT=25 : _ALIENS=20
  62. ' Set up some initial values...
  63. _SCORE=0 : Rem                ' 500 points per alien.   
  64. _ALIENSKILLED=0 : Rem         ' You win when you kill them all.  
  65. _BLIPS=0 : Rem                ' Number of aliens in scanner range.  
  66. _PLYRX=10 : _PLYRY=10 : Rem   ' Player starting co-ordinates.
  67. Dim _MAP$(_MAPWID-1,_MAPHGT-1) : Rem ' Main array, holding map data.
  68. Dim _ALIENX(_ALIENS-1),_ALIENY(_ALIENS-1) : Rem ' Aliens' co-ordinates array.
  69. Dim _BLIPX(_ALIENS),_BLIPY(_ALIENS) : Rem ' Scanner blips' co-ordinates array. 
  70. Gosub _INITIALISE : Rem ' Set everything up. 
  71. Gosub _DRAWGRID : Rem   ' Draw the 5*5 main play area. 
  72. ' Main game loop 
  73. _DEAD=False
  74. Repeat 
  75.    Gosub _DRAWMAP : Rem  ' Fill the grid with what you can see.
  76.    ' Test for key presses...
  77.    _MOVEUP=Key State($4C) : _MOVEDOWN=Key State($4D)
  78.    _MOVELEFT=Key State($4F) : _MOVERIGHT=Key State($4E)
  79.    _FIRE=Key State($40)
  80.    ' For each direction the player tries to move in, check whether they can,
  81.    ' and if so, move them. Keep track of LastMove, because this is the
  82.    ' direction you fire in. 
  83.    If _MOVEUP and(_PLYRY>0) Then If(_MAP$(_PLYRX,_PLYRY-1)=" ") Then Dec _PLYRY : _LASTMOVE=_UP
  84.    If _MOVEDOWN and(_PLYRY<_MAPHGT-1) Then If(_MAP$(_PLYRX,_PLYRY+1)=" ") Then Inc _PLYRY : _LASTMOVE=_DOWN
  85.    If _MOVELEFT and(_PLYRX>0) Then If(_MAP$(_PLYRX-1,_PLYRY)=" ") Then Dec _PLYRX : _LASTMOVE=_LEFT
  86.    If _MOVERIGHT and(_PLYRX<_MAPWID-1) Then If(_MAP$(_PLYRX+1,_PLYRY)=" ") Then Inc _PLYRX : _LASTMOVE=_RIGHT
  87.    If _FIRE Then Gosub _SHOOT
  88.    Gosub _ALIENMOVE : Rem  ' Move them bad guys... 
  89.    Gosub _UPDATERADAR : Rem' The really neat bit.
  90.    ' Go until either you're dead, or they are.
  91. Until _DEAD or _ALIENSKILLED=_ALIENS
  92. ' Display ending message.
  93. Locate 0,0 : Cline 
  94. If _DEAD Then Centre "You're Dead" Else Centre "Congratulations- you killed all the aliens."
  95. End 
  96. '  
  97. _INITIALISE:
  98.    ' This routine sets up the display, and map data.
  99.    Screen Open 0,320,150,4,Lowres : Rem ' Screen 0 is main play area 
  100.    Flash Off : Curs Off : Cls 0
  101.    Pen 1 : Paper 0
  102.    Locate 0,0 : Centre "AMOS ALIENS"
  103.    Palette 0,$FFF,$555,$1AF
  104.    Screen Open 1,320,50,16,Lowres : Rem ' Screen 1 is status panel (score & radar) 
  105.    Screen Display 1,,200,,
  106.    Flash Off : Curs Off : Cls 0
  107.    Colour 0,$222
  108.    Pen 14 : Paper 0
  109.    Locate 20,1 : Print "AMOS ALIENS"
  110.    ' Set up the radar for 12 colours, green display on screen 1.  
  111.    _MAKE_RADAR_COLOURS[12,$10]
  112.    _RADAR_DRAW[40,25,25,12,6,0]
  113.    ' Initialise walls on the space station. 
  114.    For Y=0 To _MAPHGT-1
  115.       For X=0 To _MAPWID-1
  116.          If Rnd(3)=0 Then _MAP$(X,Y)="#" Else _MAP$(X,Y)=" "
  117.       Next X
  118.    Next Y
  119.    _MAP$(_PLYRX,_PLYRY)=" " : Rem ' Make sure player doesn't start on a wall.
  120. Return 
  121. '
  122. _DRAWGRID:
  123.    ' This routine uses AMOS graphics characters to draw a 5*5 display grid. 
  124.    Screen 0
  125.    Pen 3 : Paper 0
  126.    _TLY=6 : _TLX=13 : Rem ' This is the position of the grid from the top left of the screen.
  127.    ' This messy chunk draws the grid using characters. On second thoughts,
  128.    'I'd probably have been better off drawing it using graphics commands. 
  129.    For X=1 To 9
  130.       Locate _TLX+X,0+_TLY
  131.       If X mod 2 Then Print Chr$($89); Else Print Chr$($8E);
  132.       Locate _TLX+X,10+_TLY
  133.       If X mod 2 Then Print Chr$($89); Else Print Chr$($8F);
  134.       For Y=1 To 9
  135.          Locate _TLX+X,_TLY+Y
  136.          If(X mod 2)
  137.             If(Y mod 2)=0 : Print Chr$($89); : End If 
  138.          Else 
  139.             If(Y mod 2) : Print Chr$($8B)
  140.             Else Print Chr$($92)
  141.             End If 
  142.          End If 
  143.       Next Y
  144.    Next X
  145.    For Y=1 To 9
  146.       Locate _TLX,_TLY+Y
  147.       If Y mod 2 Then Print Chr$($8B); Else Print Chr$($90);
  148.       Locate _TLX+10,_TLY+Y
  149.       If Y mod 2 Then Print Chr$($8B); Else Print Chr$($91);
  150.    Next Y
  151.    Locate _TLX,_TLY : Print Chr$($88);
  152.    Locate _TLX+10,_TLY : Print Chr$($8A);
  153.    Locate _TLX,_TLY+10 : Print Chr$($8C);
  154.    Locate _TLX+10,_TLY+10 : Print Chr$($8D);
  155.    ' Randomly position all the aliens.
  156.    For I=1 To _ALIENS
  157.       X=Rnd(_MAPWID-1) : Y=Rnd(_MAPHGT-1)
  158.       ' Keep randomly generating co-ordinates until we land in an empty square.
  159.       While _MAP$(X,Y)<>" " or X=_PLYRX or Y=_PLYRY
  160.          X=Rnd(_MAPWID-1) : Y=Rnd(_MAPHGT-1)
  161.       Wend 
  162.       ' Put the alien on the map.
  163.       _MAP$(X,Y)="X"
  164.       _ALIENX(I-1)=X : _ALIENY(I-1)=Y
  165.    Next I
  166.    ' Set up drawing colours for rest of program.
  167.    Pen 1 : Paper 0
  168. Return 
  169. '
  170. _DRAWMAP:
  171.    ' This routine fills the grid with the visible contents of the array _MAP$ 
  172.    'for an area 5*5 characters big, centred on the player's current position. 
  173.    For Y=_PLYRY-2 To _PLYRY+2
  174.       For X=_PLYRX-2 To _PLYRX+2
  175.          Locate _TLX+5+(X-_PLYRX)*2,_TLY+5+(Y-_PLYRY)*2
  176.          ' If we're at the edges of the map, don't attempt to draw non-existant 
  177.          'array elements; just display a "*" for the map boundary.
  178.          If X<0 or Y<0 or X>_MAPWID-1 or Y>_MAPHGT-1 Then Print Pen$(2)+"*"+Pen$(1); Else Print _MAP$(X,Y);
  179.       Next X
  180.    Next Y
  181.    ' Draw the player on screen. 
  182.    Locate _TLX+5,_TLY+5 : Print "O";
  183.    ' And draw the score on the status panel.
  184.    Gosub _UPDATESCORE
  185. Return 
  186. '
  187. _SHOOT:
  188.    ' This procedure deals with what happens when the space bar is pressed.
  189.    ' Set up the displacements by which the bullet will move.
  190.    If _LASTMOVE=_UP Then X=0 : Y=-1
  191.    If _LASTMOVE=_DOWN Then X=0 : Y=1
  192.    If _LASTMOVE=_LEFT Then X=-1 : Y=0
  193.    If _LASTMOVE=_RIGHT Then X=1 : Y=0
  194.    ' Start from the square the player is standing in. 
  195.    _SHOTX=_PLYRX : _SHOTY=_PLYRY
  196.    Shoot : Rem ' Make a noise.
  197.    ' Since only two squares are visible in any direction, we only need to 
  198.    'move the bullet twice at most.
  199.    For I=0 To 1
  200.       ' Move the bullet to it's new square.
  201.       Add _SHOTX,X : Add _SHOTY,Y
  202.       ' If it's gone off the map, exit the loop. 
  203.       If _SHOTX<0 or _SHOTY<0 or _SHOTX>_MAPWID-1 or SHOTY>_MAPHGT-1 Then Exit 
  204.       ' If it's hit a wall, exit the loop (bullets can't travel through walls).
  205.       If _MAP$(_SHOTX,_SHOTY)="#" Then Exit 
  206.       ' If it's hit an alien, then kill him, and add to the player's score and kills.
  207.       If _MAP$(_SHOTX,_SHOTY)="X" Then Boom : _MAP$(_SHOTX,_SHOTY)=" " : Add _SCORE,500 : Inc _ALIENSKILLED : Gosub _UPDATESCORE
  208.       ' If it's in an empty square, draw the bullet, wait a few seconds, then go on. 
  209.       If _MAP$(_SHOTX,_SHOTY)=" " Then Locate _TLX+5+(_SHOTX-_PLYRX)*2,_TLY+5+(_SHOTY-_PLYRY)*2 : Print "."; : Wait 5 : Print Cleft$+" ";
  210.    Next I
  211. Return 
  212. '
  213. _ALIENMOVE:
  214.    ' This procedure moves the aliens about the map at random. 
  215.    ' Do this for each alien.  
  216.    For I=0 To _ALIENS-1
  217.       ' Only do this if the alien is still alive.
  218.       If _MAP$(_ALIENX(I),_ALIENY(I))="X"
  219.          ' Erase the alien at his last position.
  220.          _MAP$(_ALIENX(I),_ALIENY(I))=" "
  221.          ' Generate a random direction. NB There is a 50% chance of the alien 
  222.          'not moving at all. If they always move, then the game is far too
  223.          'difficult, as they're just too quick. 
  224.          DRCTN=Rnd(8)
  225.          ' Check that the chosen direction is viable, and if so move the alien
  226.          'to the new square.
  227.          ' NB I know that block If..Else...EndIf statements would run faster
  228.          'here, but they just make the code so messy in AMOS. If only AMOS had
  229.          'an ElseIf clause, like AmigaBASIC.
  230.          If DRCTN=0 and _ALIENY(I)>0 : If _MAP$(_ALIENX(I),_ALIENY(I)-1)<>"#" : Dec _ALIENY(I) : End If : End If 
  231.          If DRCTN=1 and _ALIENY(I)<_MAPHGT-1 : If _MAP$(_ALIENX(I),_ALIENY(I)+1)<>"#" : Inc _ALIENY(I) : End If : End If 
  232.          If DRCTN=2 and _ALIENX(I)>0 : If _MAP$(_ALIENX(I)-1,_ALIENY(I))<>"#" : Dec _ALIENX(I) : End If : End If 
  233.          If DRCTN=3 and _ALIENX(I)<_MAPWID-1 : If _MAP$(_ALIENX(I)+1,_ALIENY(I))<>"#" : Inc _ALIENX(I) : End If : End If 
  234.          ' Redraw the alien at his new home.  
  235.          _MAP$(_ALIENX(I),_ALIENY(I))="X"
  236.          ' If he's collided with the player, it's all over... 
  237.          If _ALIENX(I)=_PLYRX and _ALIENY(I)=_PLYRY : Gosub _DRAWMAP : Boom : _DEAD=True : End If 
  238.       End If 
  239.    Next I
  240. Return 
  241. '
  242. _UPDATERADAR:
  243.    ' This routine shows how to make use of the _PLOT_BLIP instruction.
  244.    Screen 1 : Rem ' First switch to the radar screen.
  245.    ' Before drawing new blips, we have to erase the old ones. The BLIPS and 
  246.    'BLIPX,BLIPY variables store all the information from last time around the 
  247.    'loop. 
  248.    While _BLIPS
  249.       ' Erase this blip, then go on to the next one. 
  250.       _PLOT_BLIP_RECT[_BLIPX(_BLIPS-1)*3,_BLIPY(_BLIPS-1)*3]
  251.       Dec _BLIPS
  252.    Wend 
  253.    ' Scan a 25*25 square area around the player for aliens. 
  254.    For Y=_PLYRY-5 To _PLYRY+5
  255.       For X=_PLYRX-5 To _PLYRX+5
  256.          ' Don't try and access non-existant array elements if we're at the 
  257.          'map's boundary... 
  258.          If Y>=0 and Y<_MAPHGT and X>=0 and X<_MAPWID
  259.             ' If we've found an alien, record it in the blips variables, and 
  260.             'go on checking the other squares. 
  261.             If _MAP$(X,Y)="X"
  262.                _BLIPX(_BLIPS)=X-_PLYRX : _BLIPY(_BLIPS)=Y-_PLYRY
  263.                Inc _BLIPS
  264.             End If 
  265.          End If 
  266.       Next X
  267.    Next Y
  268.    ' Play a beep which gets higher in pitch, the more aliens there are on the 
  269.    'scanner (adds to the tension).
  270.    If _BLIPS Then Sam Play %11,1,_BLIPS*1000+5000
  271.    ' Now plot all the new blips on the radar. 
  272.    I=_BLIPS
  273.    While I
  274.       ' I'm using a *3 multiplier, since the actual pixel distances would be 
  275.       'too small for the scanner to be used effectively. 
  276.       _PLOT_BLIP_RECT[_BLIPX(I-1)*3,_BLIPY(I-1)*3]
  277.       Dec I
  278.    Wend 
  279.    ' Return to the main playing screen. 
  280.    Screen 0
  281. Return 
  282. '
  283. _UPDATESCORE:
  284.    ' Switch to the status panel (screen1) and print the score...
  285.    Screen 1
  286.    Locate 20,3
  287.    Pen 14 : Paper 0
  288.    Print "Score :";Str$(_SCORE);
  289.    Screen 0
  290. Return 
  291. '
  292. '
  293. ' RADAR PROCEDURES 
  294. '
  295. Procedure _RADAR_DRAW[X,Y,R,SEGS,SPEED,_DIRECTION]
  296. Shared _RADARX,_RADARY,_RADARSIZE
  297. '
  298. '  Inputs... 
  299. '        X,Y - The co-ordinates of the centre of the radar.  
  300. '        R -   The circular radius of the radar (in pixels). 
  301. '        SEGS- The number of segments to chop the radar into. The smaller
  302. '             this value, the fewer colours are used up by the radar. The
  303. '             higher this value, the smoother the animation of the radar.
  304. '             12 is about the practical minimum. 
  305. '        SPEED-The speed at which the radar animates.
  306. '        _DIRECTION- The direction in which the radar 'arm' spins. 
  307. '             0=clockwise, 1=anticlockwise.  
  308. '
  309. ' ************************** 
  310. '
  311. '  Shared variables... 
  312. '        _RADARX,_RADARY - These are initialised to the X and Y values passed  
  313. '              to the procedure, to enable the BLIP procedures to plot blips 
  314. '              relative to the origin of the radar.
  315. '        _RADARSIZE - This is initialised to the R value passed to this  
  316. '              procedure, and is used for range checking in the BLIP procedures. 
  317. '
  318. ' ************************** 
  319. '
  320. '  External stuff... 
  321. '         This procedure uses the AMOS maths functions, so requires the  
  322. '         mathtrans.library to be in the LIBS: directory of your boot disk.
  323. '
  324. ' ************************** 
  325. '
  326.    Degree : Rem ' I can't work in radians. 
  327.    Circle X,Y,R : Rem ' Draw the outline of the radar. 
  328.    _RDR_STEP=360/SEGS : Rem ' Calculate the angular step.
  329.    ' Now for the mathematical bit...
  330.    '  This loop divides the circle up into segments by drawing two arcs 
  331.    ' to the circumference from the origin. The loop index is theta, the 
  332.    ' bearing from the line SO (which goes from the south point of the circle
  333.    ' to the origin). Using trigonometry, we work out the co-ords (X1,Y1) where
  334.    ' the first arc meets the circumference, and (X2,Y2) where the second arc
  335.    ' meets the circumference. These co-ords are relative to the circle's
  336.    ' origin. We then outline the segment, and get the co-ords of a point  
  337.    ' somewhere in the middle of this segment (XFILL,YFILL), and do a flood
  338.    ' fill. Doing this with successively brighter shades of the same colour
  339.    ' makes a pretty, graduated colour fill, which can then be rotated using 
  340.    ' the shift up command.
  341.    For _RDR_THETA=0 To 360-(2*_RDR_STEP-1) Step _RDR_STEP
  342.       X1=R*Sin(_RDR_THETA) : Y1=R*Cos(_RDR_THETA)
  343.       X2=R*Sin(_RDR_THETA+_RDR_STEP) : Y2=R*Cos(_RDR_THETA+_RDR_STEP)
  344.       If _DIRECTION=0 Then Ink(360-(2*_RDR_STEP-1)-_RDR_THETA)/_RDR_STEP+2 Else Ink _RDR_THETA/_RDR_STEP+1
  345.       Polyline X+X1,Y+Y1 To X,Y To X+X2,Y+Y2
  346.       XFILL=X+(X1+X2)/2 : YFILL=Y+(Y1+Y2)/2
  347.       Paint XFILL,YFILL,1
  348.    Next _RDR_THETA
  349.    '  Due to inaccuracies in calculation, we don't draw the arc boundaries  
  350.    ' for the last segment. Since they're already there, we simply fill the
  351.    ' hole.
  352.    If _DIRECTION=0 Then Ink(360-(2*_RDR_STEP-1)-_RDR_THETA)/_RDR_STEP+1 Else Ink _RDR_THETA/_RDR_STEP+1
  353.    X1=0 : Y1=R
  354.    XFILL=X+(X1+X2)/2 : YFILL=Y+(Y1+Y2)/2
  355.    Paint XFILL,YFILL
  356.    ' Finally, erase the circle outline, and the radar is complete.
  357.    Ink 0
  358.    Circle X,Y,R
  359.    ' Now animate it.
  360.    Shift Up SPEED,1,SEGS,1
  361.    _RADARX=X : _RADARY=Y : _RADARSIZE=R
  362. End Proc
  363. '
  364. Procedure _PLOT_BLIP[THETA,R]
  365. Shared _RADARX,_RADARY,_RADARSIZE
  366. '
  367. '  Inputs... 
  368. '        THETA, R - The polar co-ordinates of the position of the blip you 
  369. '              want to plot, relative to the centre of the radar.
  370. '
  371. ' ************************** 
  372. '
  373. '  Shared variables... 
  374. '        _RADARX,_RADARY - These are initialised to the X and Y values passed  
  375. '              to the procedure, to enable the BLIP procedures to plot blips 
  376. '              relative to the origin of the radar.
  377. '        _RADARSIZE - This is initialised to the R value passed to this  
  378. '              procedure, and is used for range checking in the BLIP procedures. 
  379. '
  380. ' ************************** 
  381. '
  382. ' NB To plot a blip, call this procedure. If you want to move the blip, you
  383. ' must call this procedure to unplot the first blip, then call it again to 
  384. ' reposition. Look at the demo program (the _UPDATE_RADAR subroutine) to see 
  385. ' how this should be done. You must also switch to the screen on which the 
  386. ' radar has been drawn before calling this procedure.
  387. '
  388.    If R>_RADARSIZE Then Pop Proc : Rem ' Don't plot if beyond bounds of radar.
  389.    ' Calculate the screen co-ords of the centre of the blip.
  390.    X=_RADARX+R*Sin(THETA) : Y=_RADARY+R*Cos(THETA)
  391.    ' Set to XOR mode. 
  392.    Gr Writing 2 : Ink 31
  393.    ' Draw blip as a + symbol. Can anyone think of a better way of doing it? 
  394.    Plot X,Y : Plot X+1,Y : Plot X,Y+1
  395.    Plot X-1,Y : Plot X,Y-1
  396. End Proc
  397. '
  398. Procedure _PLOT_BLIP_RECT[X,Y]
  399. Shared _RADARX,_RADARY,_RADARSIZE
  400. '
  401. '  Inputs... 
  402. '        X, Y - The cartesian co-ordinates of the position of the blip you 
  403. '              want to plot, relative to the centre of the radar.
  404. '
  405. ' ************************** 
  406. '
  407. '  Shared variables... 
  408. '        _RADARX,_RADARY - These are initialised to the X and Y values passed  
  409. '              to the procedure, to enable the BLIP procedures to plot blips 
  410. '              relative to the origin of the radar.
  411. '        _RADARSIZE - This is initialised to the R value passed to this  
  412. '              procedure, and is used for range checking in the BLIP procedures. 
  413. '
  414. ' ************************** 
  415. '
  416. ' NB This procedure is identical to _PLOT_BLIP, except that it uses cartesian
  417. '   (X,Y) co-ordinates, rather than polar (R,�) co-ords. See the notes for 
  418. '   _PLOT_BLIP.
  419. '
  420.    R=Sqr(X*X+Y*Y) : Rem ' Use pythagoras to calculate the R component of the co-ords.
  421.    If R>_RADARSIZE Then Pop Proc : Rem ' If it lies out of bounds, then don't plot it.
  422.    ' Calculate screen co-ords of centre of blip.
  423.    X=X+_RADARX : Y=Y+_RADARY
  424.    Gr Writing 2 : Ink 31
  425.    Plot X,Y : Plot X+1,Y : Plot X,Y+1
  426.    Plot X-1,Y : Plot X,Y-1
  427. End Proc
  428. '
  429. Procedure _MAKE_RADAR_COLOURS[NUM,MASK]
  430. '
  431. '  Inputs... 
  432. '        NUM - Number of colours to calculate. 
  433. '        MASK - An RGB shading mask used to create the colour range. 
  434. '
  435. ' ************************** 
  436. '
  437. ' NB This procedure knocks up a spread of colours using colours 1 to NUM,  
  438. ' from dark to light, using a simple algorithm of multiplying an intensity 
  439. ' by the provided RGB mask. Call this directly before calling _MAKE_RADAR. 
  440. ' Give the same value for SEGS in _MAKE_RADAR as for NUM here. 
  441. ' You could, of course, forget this procedure altogether and just knock up 
  442. ' your own colours for the radar.
  443. '  Example values for this mask: (don't forget the $ sign) 
  444. '    $1   - Creates a Blue radar.
  445. '    $10  -    "    " Green  "  .
  446. '    $100 -    "    " Red    "  .
  447. '    $11  - Creates a Turquoise (Cyan) radar.
  448. '    $101 -    "    " Purple radar.
  449. '    $110 -    "    " Yellow "  .
  450. '    $111 -    "    " Grey   "  .
  451. '
  452.    For _RDR_INDEX=1 To NUM
  453.       Colour _RDR_INDEX,(_RDR_INDEX-1)*MASK
  454.    Next _RDR_INDEX
  455. End Proc